#pragma once
#include <QGraphicsRectItem>
#include <QFont>
#include <GraphicsBaseItem.h>

class GraphicsTextItem :public QObject, public QGraphicsRectItem
{
	Q_OBJECT;
public:
	GraphicsTextItem(GraphicsBaseItem* parent);
public:
	void setText(const QString& text);
public slots:
	void onRefreshPostion();
private:
	QFont getFont()const;
protected:
	virtual void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = nullptr) override;
private:
	QString m_text;
	GraphicsBaseItem* m_parent = nullptr;
	enum PositionType {
		TopLeft_Enum,
		TopRight_Enum,
		BottomRight_Enum,
		BottomLeft_Enum,
		None_Enum
	};
	PositionType m_positionType;
};

